<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/taglibs.jsp"%>

<form action="${ctx}/sys/person/update" method="post">
    <table>
        <tbody>
            <tr>
                <td><label for="updateform-id">人员ID</label></td>
                <td><input type="text" id="updateform-id" name="id" value="${person.id}" readonly="readonly" class="easyui-textbox"
                        data-options="validType:'length[0,32]', prompt:'不输入时会自动生成'"/>
                </td>
            </tr>
            <tr>
                <td><label for="updateform-name">人员名称</label></td>
                <td><input type="text" id="updateform-name" name="name" value="${person.name}" class="easyui-textbox"
                        data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td><label for="updateform-orgId">组织ID</label></td>
                <td><input type="text" id="updateform-orgId" name="orgId" value="${person.orgId}" readonly="readonly" class="easyui-textbox"
                        data-options="required:true, validType:'length[0,32]'"/>
                </td>
            </tr>
            <tr>
                <td><label for="updateform-parentId">上级组织</label></td>
                <td><input type="text" id="updateform-parentId" name="parentId" value="${person.parentId}" class="easyui-textbox"
                        data-options="required:true, validType:'length[0,32]'"/>
                </td>
            </tr>
            <tr>
                <td><label for="updateform-order">排序号</label></td>
                <td><input type="text" id="updateform-order" name="order" value="${person.order}" class="easyui-textbox"
                        data-options="validType:'number'"/>
                </td>
            </tr>
        </tbody>
    </table>
</form>

<script type="text/javascript">
$(function(){
    var $parentId = $('#updateform-parentId').combotree({
        url: ctx + '/sys/org/list',
        queryParams: {
            tree: true,
            orgTypes: ['company', 'dept', 'post'],
        },
        lines: true,
        formatter: function(node) {
            return node.name || node.id;
        },
        onLoadSuccess: function(node, data) {
            var node = $parentId.combotree('tree').tree('find', $parentId.val());
            $parentId.combotree('setValue', node.id).combo('setText', node.name);
        },
        onClick: function(node) {
            $parentId.combotree('setValue', node.id).combo('setText', node.name);
        }
    });
});
</script>
